package com.shop.admin.enums;

import lombok.Getter;

import java.io.Serializable;

/**
 * 客户端平台类型枚举类
 *
 * @author Jerry  2019-11-22 16:05:38
 */
@Getter
public enum ClientTypeEnum implements Serializable {

    DEFAULT("PC", 1, 30 * 60),
    PC("PC", 1, 30 * 60),
    IOS("IOS", 2, 30 * 60 * 24),
    ANDROID("ANDROID", 2, 30 * 60 * 24),
    H5("H5", 3, 7 * 60 * 24)
    ;

    private String str;
    private int atCode;
    private int expireTime;

    ClientTypeEnum(String str, int atCode, int expireTime) {
        this.str = str;
        this.atCode = atCode;
        this.expireTime = expireTime;
    }

    /**
     * 获取转化为大写字符串的Name对应的实例
     *
     * @return
     */
    public static ClientTypeEnum getInstance(String platform) {
        if ("IOS".equalsIgnoreCase(platform)) return IOS;
        else if ("ANDROID".equalsIgnoreCase(platform)) return ANDROID;
        else if ("H5".equalsIgnoreCase(platform)) return H5;
        else if ("PC".equalsIgnoreCase(platform)) return PC;
        else return DEFAULT;
    }

}
